package cn.zero.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.zero.model.WechatInfo;
import cn.zero.repository.WechatInfoRepository;
import cn.zero.service.WechatInfoService;

@Service("wechatInfoService")
public class WechatInfoServiceImpl implements WechatInfoService {

	@Autowired
	private WechatInfoRepository wechatInfoRepository;
	
	@Override
	@Transactional
	public WechatInfo save(WechatInfo wechatInfo) {
		return wechatInfoRepository.save(wechatInfo);
	}

	@Override
	@Transactional(readOnly = true)
	public WechatInfo getByOpenid(String openid) {
		return wechatInfoRepository.get(openid);
	}

	@Override
	@Transactional(readOnly = true)
	public WechatInfo get(String appid, Long userId) {
		return wechatInfoRepository.get(appid, userId);
	}

}
